package com.lanou3g.code0418.control;

import com.lanou3g.code0418.methods.ThreadUtil;

/**
 * If there are no bugs, it was created by Chen FengYao on 2018/4/18;
 * Otherwise, I don't know who created it either
 */

public class Test01 {
    public static void main(String[] args) {

        new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    System.out.println("A");
                    // 线程自己想要放弃掉CPU等资源
                    // 但是 具体是否CPU就放弃他了
                    // 还是CPU说的算
                    Thread.yield();
                }
            }
        }).start();

        new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    System.out.println("B");
                    Thread.yield();
                }
            }
        }).start();
    }
}
